package com.googlecode.continuity.core.server.hibernate;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;

import org.hibernate.type.TimestampType;

/**
 * DateTimeType, a custom user type that converts SQL timestamps into Java Dates, preventing the Dates to be filled with
 * java.sql.Timestamp by Hibernate.
 *
 * @deprecated This class is obsolete, classes get transformed during GWT serialization now.
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class DateTimeType extends TimestampType {
  public Object get(ResultSet rs, String name) throws SQLException {
    Timestamp timestamp = (Timestamp) super.get(rs, name);
    if (timestamp == null) {
      return null;
    }
    return new java.util.Date(timestamp.getTime());
  }
}
